package com.hnevc.liangxiangju;


/**
 *
 * 超市对象
 *
 */
public class Market {
    private String marketName; //超市名称
    private Product[] products;//商品是一个对象，并且存在很多的商品，商品拥有自己的属性

    public Market(String marketName, Product[] products) {
        this.marketName = marketName;
        this.products = products;
    }

    public Market(String marketName) {
        this.marketName = marketName;
    }
    public Market(){

    }
    public String getMarketName() {
        return marketName;
    }

    public void setMarketName(String marketName) {
        this.marketName = marketName;
    }

    public Product[] getProducts() {
        return products;
    }

    public void setProducts(Product[] products) {
        this.products = products;
    }

    Product sell (String proName){
        for (int i=0;i< products.length;i++){
            if (products[i].getProName() == proName){
                return products [i];
            }
        }
        return null;
    }
}
